package com.zyt.service.impl;

import com.zyt.entity.*;
import com.zyt.mapper.*;
import com.zyt.mapper.BookMapper;
import com.zyt.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressMapper addressMapper;
    @Override
    public List<Address> selectAllAddress(Integer userId) {
        return addressMapper.selectAllAddress(userId);
    }

    @Override
    public void deleteById(Integer addreddId) {
        addressMapper.deleteById(addreddId);
    }

    @Override
    public void updateSelectedState(Integer userId, Integer addressId) {
        addressMapper.updateSelectedStateToNull(userId);
        addressMapper.updateSelectedStateToSelected(addressId);
    }

    @Override
    public void insertAll(String name, String address, String mobile) {
        addressMapper.insertAll(name,address,mobile);
    }
}
